import java.util.List;

import com.seres.backend.AnswerDecision;
import com.seres.backend.Decision;
import com.seres.backend.GameState;
import com.seres.data.Ace;
import com.seres.data.AceCategory;
import com.seres.data.Answer;
import com.seres.events.AcesInfoEvent;
import com.seres.events.DecisionEvent;
import com.seres.events.GameStateEvent;
import com.seres.events.ScenarioInfoEvent;
import com.seres.general.EventBroker;
import com.seres.listeners.AcesInfoListener;
import com.seres.listeners.ScenarioInfoListener;


public class TestListener implements AcesInfoListener,ScenarioInfoListener{
	private Answer answer1;
	public TestListener(){
		EventBroker.getEventBroker().addAcesInfoListener(this);
		EventBroker.getEventBroker().addScenarioInfoListener(this);
	}
	@Override
	public void processAcesInfo(AcesInfoEvent event) {
		List<AceCategory> categories = event.getAceCategories();
		for( AceCategory category : categories){
			System.out.println(category.getCategoryName());
			List<Ace> aces = category.getAces();
			for(Ace ace : aces){
				System.out.println(ace.getShortDescription());
				System.out.println(ace.getFullDescription());
			}
		}
		System.out.println("aantal ace categories: " + categories.size());
	}
	@Override
	public void processScenarioInfo(ScenarioInfoEvent event) {
//		System.out.println(event.getScenario().getFullDescription());
		answer1 = event.getScenario().getAnswer(0);
		
	}
	
	public void askForNextAction(){
		EventBroker.getEventBroker().fireGameStateEvent(new GameStateEvent(GameState.START_NEXT_ACTION));
	}
	public void tryToRegisterDecision(){
		AnswerDecision dec = new AnswerDecision(answer1);
		EventBroker.getEventBroker().fireDecisionEvent(new DecisionEvent(dec));
	}

}
